{% extends '_base_create_update.html' %}
{% load static %}
{% load bootstrap3 %}
{% load i18n %}

{% block form %}
    <form action="" method="post" class="form-horizontal">
    {% if form.non_field_errors %}
         <div class="alert alert-danger">
             {{ form.non_field_errors }}
         </div>
    {% endif %}
    {% csrf_token %}
    <h3>{% trans 'Basic' %}</h3>
    {% bootstrap_field form.name layout="horizontal" %}
    {% bootstrap_field form.data_type layout="horizontal" %}
    {% bootstrap_field form.data_mode layout="horizontal" %}


    <div class="hr-line-dashed"></div>
    <h3>{% trans 'Device Info' %}</h3>
    {% bootstrap_field form.slave_addr layout="horizontal" %}
    {% bootstrap_field form.registaddr layout="horizontal" %}
    {% bootstrap_field form.data_len layout="horizontal" %}

    <div class="hr-line-dashed"></div>
    <h3>{% trans 'Data Info' %}</h3>
    {% bootstrap_field form.expre layout="horizontal" %}
    {% bootstrap_field form.data_uint layout="horizontal" %}
    {% bootstrap_field form.uint_name layout="horizontal" %}
    {% bootstrap_field form.data_key layout="horizontal" %}
    {% bootstrap_field form.isstore layout="horizontal" %}
    {% bootstrap_field form.templet layout="horizontal" %}

    <div class="hr-line-dashed"></div>
    <h3>{% trans 'Other' %}</h3>
    {% bootstrap_field form.comment layout="horizontal" %}

    <div class="hr-line-dashed"></div>
    <div class="form-group">
        <div class="col-sm-4 col-sm-offset-2">
            <button class="btn btn-default" type="reset"> {% trans 'Reset' %}</button>
            <button id="submit_button" class="btn btn-primary" type="submit">{% trans 'Submit' %}</button>
        </div>
    </div>
    </form>
{% endblock %}

{% block custom_foot_js %}
    <script>
        $(document).ready(function () {
            $('.select2').select2();
            $("#id_tags").select2({
                tags: true,
                maximumSelectionLength: 8  //最多能够选择的个数
                //closeOnSelect: false
            });
        })
    </script>
{% endblock %}